home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / mail / mh / contrib / queuemh / queuemh-scripts / dscan < prev    next >
Encoding:
Text File  |  1992-11-08  |  899 b   |  53 lines

  1. #!/usr/local/bin/perl
  2. #
  3. #
  4. # MH scan those messages whose message numbers end in the digits given
  5. # on the command line.
  6. #     Usage: sscan [+folder] N ...
  7. #        Where N is a single digit
  8. #
  9.  
  10. $FORM="/homes/troubmh/Mail/stat.form";
  11. ##
  12. # Set the folder
  13. #
  14. if ( $ARGV[0] =~ /^\+/ )
  15. {
  16.     $FOLDER = substr($ARGV[0],1);
  17.     shift;
  18. } else
  19. {
  20.     if ( $ENV{'FOLDER'} eq '' )
  21.     {
  22.         $FOLDER = `folder -fast`;
  23.         chop $FOLDER;
  24.     }
  25.     else 
  26.     {
  27.         $FOLDER = $ENV{'FOLDER'};
  28.     }
  29. }
  30.  
  31. ##
  32. # get the digits
  33. #
  34.  
  35. if ( $#ARGV < 0 || $ARGV[0] eq '-help' || $ARGV[0] > 9 || $ARGV[0] < 0 )
  36. {
  37.     print "Usage: $0 [+folder] digit_list\ndigit_list is space delimited\n";
  38.     exit 1;
  39. }
  40.  
  41. $first = `pick +$FOLDER first`;
  42. $last = `pick +$FOLDER last`;
  43. $dir = `mhpath +$FOLDER`; chop $dir;
  44.  
  45. $digits = join('',@ARGV);
  46.  
  47. for ( $first .. $last )
  48. {
  49.     push(@msglist,$_) if ( $_ =~ /[$digits]$/ && -s "$dir/$_" );
  50. }
  51.  
  52. exec 'scan', "+$FOLDER", '-form', $FORM, @msglist;
  53.